package com.jqq.try_;

import java.util.Scanner;

/**
 * @author 姬倩倩
 * @version 1.0
 */
public class TryCatchExercise {
    public static void main(String[] args) {
        System.out.println("请输入一个整数：");
        while(true) {
            try {
                Scanner scanner = new Scanner(System.in);
                int num = Integer.parseInt(scanner.next());
                System.out.println("num = " + num);
                break;
            } catch (Exception e) {
                System.out.println("异常信息："+e.getMessage());
                System.out.println("请重新输入：");
            }
        }
        System.out.println("程序继续。。");
    }
}
